'use strict'
const path = require('path')

function resolve(dir) {
    return path.join(__dirname, dir)
}

module.exports = {
    publicPath: '/',
    outputDir: 'dist',
    assetsDir: 'static',
    lintOnSave: false,
    productionSourceMap: process.env.NODE_ENV === 'development',
    configureWebpack: {
        name: '测试',
        resolve: {
            alias: {
                '@': resolve('src')
            }
        }
    },
    chainWebpack: config => {
        // 解决 "window is undefined", 这是因为 worker 线程中不存在 window 对象,  要用 this 代替 
        config.module.rule('worker')
            .test(/\.worker\.js$/)
            .use('worker-loader')
            .loader('worker-loader')
            .options({ inline: 'fallback' })
    }
}
